<template>
  <div class="info-show">
    <el-row type="flex" class="row-bg" justify="center">
      <el-col :span="8">
        <div class="user">
          <img :src="avatar" alt="">
          <div class="editUser">
            <el-button type="warning" @click="handleEdit()" plain>
              <i class="el-icon-edit"></i> 编辑
            </el-button>
          </div>
        </div>
      </el-col>
      <el-col :span="16">
        <div class="user-info">
          <div class="user-item">
            <i class="el-icon-user-solid"></i>
            <span>{{user.name}}</span>
          </div>
          <div class="user-item">
            <i class="el-icon-message"></i>
            <span>{{user.email}}</span>
          </div>
          <div class="user-item">
            <i class="el-icon-s-tools"></i>
            <span>{{user.identity === "manager" ? "管理员" : "普通员工"}}</span>
          </div>
        </div>
      </el-col>
    </el-row>

    <EditUserDialog
    :dialog="dialog">
    </EditUserDialog>

  </div>
</template>

<script>
  import EditUserDialog from "../components/EditUserDialog";
  export default {
    name: "InfoShow",
    components: {EditUserDialog},
    computed: {
      user(){
        return this.$store.getters.user;
      },
      avatar(){
        return this.$store.getters.avatar;
      }
    },
    data(){
      return {
        dialog: {
          show: false
        }
      };
    },
    methods: {
      handleEdit() {
        this.dialog.show = true;
      }
    }
  }
</script>

<style scoped>
  .info-show{
    width: 100%;
    height: 100%;
    box-sizing: border-box;
  }
  .row-bg{
    width: 100%;
    height: 100%;
  }
  .user{
    text-align: center;
    position: relative;
    top: 30%;
  }
  .user>img{
    width: 150px;
    height: 150px;
    border-radius: 50%;
  }
  .editUser{
    margin-top: 20px;
  }
  .user-info{
    height: 100%;
    background-color: #eee;
  }
  .user-item{
    position: relative;
    top: 30%;
    padding: 26px;
    color: #333;
    font-size: 28px;
  }
  .user-item>span{
    margin-left: 10px;
  }
</style>